﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using UCOLOR.Helpers;
using UCOLOR.Model;
using UColor.WPF;

namespace UCOLOR.View
{
    /// <summary>
    /// HomeView.xaml 的交互逻辑
    /// </summary>
    public partial class TemplateView : UCModule 
    {
        public TemplateView()
        {
            InitializeComponent();
            ShowTemplate();
        }

        //public System.Collections.Hashtable tabList = new System.Collections.Hashtable();
        /// <summary>
        /// Template类型
        /// </summary>
        /// <param name="catalog_no"></param>
        public void ShowTemplate()
        {
            IList<SalesTemplateType> list = DataHelper.GetSalesTemplateType();
            TabControl tab;
            tab = new TabControl();
            tab.Uid = "tabTemplate";
            foreach (SalesTemplateType part in list)
            {
                TabItem temptb = new TabItem();
                temptb.Header = part.description;
                tab.Items.Add(temptb);
                //tab.SelectedIndex = tab.Items.Count - 1;
                TemplateListView templateListView = new TemplateListView(part.template_type);
                templateListView.ParentModulePage = this.ParentModulePage;
                temptb.Content = templateListView;
                temptb.Padding = new Thickness(2, 2, 2, 2);
            }
            this.Center.ColumnDefinitions.Clear();
            int cCount = this.Center.Children.Count;
            for (int i = 0; i < cCount; i++)
            {
                this.Center.Children.RemoveAt(0);
            }
            //this.ViewList.Add(Key, view);
            tab.Margin = new Thickness(0, 3, 0, 0);
            this.Center.Children.Add(tab);
            tab.SetValue(Grid.ColumnProperty, 0);
        }
    }
}
